#include <iostream>
#include <vector>

using namespace std;

vector<int> chosen;

int n, m;
void calc(int i, int cnt){
    
    if(cnt == m){
        for(int i = 0; i < chosen.size(); i ++){
            cout << chosen[i] << " ";   
        }
        cout << '\n';
        return;
    }
    
    
    chosen.push_back(i);
    calc(i + 1, cnt + 1);
    chosen.pop_back();
    calc(i + 1, cnt);
}

int main(){
    cin >> n >> m;
    calc(1, 0);
    
    return 0;
}